/*
 * @Author: Dorange.Wang
 * @Date: 2021-06-07 09:32:12
 * @LastEditors: your name
 * @LastEditTime: 2021-06-16 17:44:42
 * @Description: file content
 */
const isDesigner = process.env.VUE_APP_USER === 'ADMIN'

const state = {
  data: {}, // 流程设计器 当前版本信息
  rightVisible: false
}
const mutations = {
  SET_PROCESS_DATA (state, payload) {
    state.data = payload
  },
  SET_RIGHT_ASIDE_VISIBLE (state, payload) {
    state.rightVisible = payload
  }
  // SET_ACTIVATED (state) {
  //   state.data = {
  //     ...state.data,
  //     activated: 1
  //   }
  // },
  // SET_PUBLISHED () {
  //   state.data = {
  //     ...state.data,
  //     published: 1
  //   }
  // }
}
const actions = {

}
const getters = {
  processData (state) {
    return state.data
  },
  processCanActivate (state) {
    return state.data?.activated === 0 && isDesigner
  },
  processCanPublish (state) {
    return state.data?.published !== 1 && isDesigner
  },
  processCanEdit (state) {
    return state.data?.published !== 1 && isDesigner
  },
  rightVisible (state) {
    return state.rightVisible
  }
}

export default {
  getters,
  state,
  mutations,
  actions
}
